package com.qf.controller;

import com.qf.pojo.Orderform;
import com.qf.pojo.Recipe;
import com.qf.service.OrderformService;
import com.qf.utils.Msg;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.ArrayList;
import java.util.List;

@Controller
@RequestMapping("/orderform")
public class OrderformController {
    @Autowired
    private OrderformService orderformService;

    @RequestMapping(value = "/insert")
    @ResponseBody
    public String insert(Orderform orderform){
        int insert = orderformService.insert(orderform);
        if(insert==0){
            return "error";}
       else return "success";
    }

    @RequestMapping("/selectAll")
    @ResponseBody
    public List<Orderform> selectAll(){
        Orderform orderform=new Orderform();
        List<Orderform> select = orderformService.select(orderform);
        return select;
    }
}
